import reshandler from '../response-handler'

export default {
  invoiveArr: [{
      fullName: 'invoiceTitle',
      name: '发票抬头',
      title: '请输入公司名称或个人名称',
      maxlength: '100',
      value: '',
      type: 'text',
      errorText: '请填写发票抬头'
    },
    {
      fullName: 'company',
      name: '单位名称',
      title: '请输入单位名称',
      maxlength: '100',
      value: '',
      type: 'text'
    },
    {
      fullName: 'code',
      name: '纳税人识别码',
      title: '请输入纳税人识别码',
      maxlength: '100',
      value: '',
      type: 'number'
    },
    {
      fullName: 'registerAddress',
      name: '注册地址',
      title: '请输入注册地址',
      maxlength: '120',
      value: '',
      type: 'text'
    },
    {
      fullName: 'registerMobile',
      name: '注册电话',
      title: '请输入注册电话',
      maxlength: '32',
      value: '',
      type: 'number'
    },
    {
      fullName: 'bank',
      name: '开户银行',
      title: '请输入开户银行',
      maxlength: '32',
      value: '',
      type: 'text'
    },
    {
      fullName: 'account',
      name: '银行账号',
      title: '请输入银行账号',
      maxlength: '32',
      value: '',
      type: 'number'
    },
  ],
  personInfo: [{
      fullName: 'contacts',
      name: '联系人',
      title: '请输入联系人姓名',
      maxlength: '20',
      value: '',
      type: 'text',
      errorText: '请填写联系人姓名'
    },
    {
      fullName: 'mobile',
      name: '联系电话',
      title: '请输入联系人电话',
      maxlength: '32',
      value: '',
      type: 'number',
      errorText: '请填写联系人电话'
    },
    {
      fullName: 'areaName',
      name: '所在地区',
      title: '',
      maxlength: '',
      value: '',
      errorText: '请填写所在地区'
    },
    {
      fullName: 'address',
      name: '详细地址',
      title: '请输入详细地址',
      maxlength: '120',
      value: '',
      type: 'text',
      errorText: '请填写联系人地址'
    },
  ],
  updateInvoice: function (params, success, fail) {
    function makeData(response) {
      return Object.assign({}, response, {
        invoices: response || []
      })
    }
    params = Object.assign({}, params, {
      methodName: params.methodName,
    })
    this.$.get(params)
      .then(reshandler.success(success, fail, makeData), reshandler.error(fail))
  }

}
